package com.yuhang.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuhang.entity.HyRepair;
import com.yuhang.mapper.HyRepairMapper;
import com.yuhang.service.HyRepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yuhang
 * @since 2021-04-24
 */
@Service
public class HyRepairServiceImpl extends ServiceImpl<HyRepairMapper, HyRepair> implements HyRepairService {

    @Autowired
    private HyRepairMapper hyRepairMapper;

    @Override
    public IPage<HyRepair> selectByPage(int pageNum, int pageSize, String likename, String liketelephone) {
        Page<HyRepair> page = new Page(pageNum,pageSize);
        QueryWrapper<HyRepair> qw = new QueryWrapper();
        if(likename!=null&&!likename.equals("")){
            qw.like("username",likename);
        }
        if(liketelephone!=null&&!liketelephone.equals("")){
            qw.like("telephone",liketelephone);
        }
        IPage<HyRepair> iPage = hyRepairMapper.selectPage(page,qw);
        return iPage;
    }
}
